package util

import (
	"bufio"
	"io"
	"os"
)

/*
ReadConfFile 读取.conf文件,返回[]string,一行是一个数据
*/
func ReadConfFile(path string) ([]string, error) {

	var ret []string

	file, err := os.Open(path)
	if err != nil {
		return nil, err
	}
	defer file.Close()

	r := bufio.NewReader(file)
	for {

		data, _, err := r.ReadLine()

		if err != nil {
			if err != io.EOF {
				return nil, err
			}
			break
		}

		ret = append(ret, TrimStr(string(data)))
	}

	return ret, nil
}
